#include<iostream>
#include<vector>
#include<unordered_map>
using namespace std;

class Solution {
public:
    int fourSumCount(vector<int>& nums1, vector<int>& nums2, vector<int>& nums3, vector<int>& nums4) {
        unordered_map<int, int> map;
        int count = 0;
        for(int i : nums1){
            for(int j : nums2){
                map[i + j]++;
            }
        }
        for(int k : nums3){
            for(int q : nums4){
                int target = 0 - (k + q);
                if(map.find(target) != map.end()){
                    count += map[target];
                }
            }
        }
        return count;
    }
};

int main()
{
    Solution s;
    vector<int> nums1 = {1,2};
    vector<int> nums2 = {-2,-1};
    vector<int> nums3 = {-1,2};
    vector<int> nums4 = {0,2};
    cout << s.fourSumCount(nums1, nums2, nums3, nums4) << endl;
    return 0;
}